import request from '@/util/request'

export function login(username, password) {
    return request({
        url: '/user/login',
        method: 'post',
        data: {
            username: username,
            password: password
        }
    })
}

export function userinfo() {
    return request({
        url: '/user/userinfo',
        method: 'get'
    })
}

export function userUpdate(userinfo) {
    return request({
        url: '/user/update',
        method: 'post',
        data: userinfo
    })
}

export function userUploadAvatar(avatar) {
    return request({
        url: '/user/upload/avatar',
        method: 'post',
        data: avatar,
        headers: {
            'Content-Type': 'multipart/form-data'
        },
    })
}